Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart: Add controller.service.external.labels & controller.service.internal.labels. #12704

Merged

Conversation

samuelarogbonlo
Copy link
Contributor

@samuelarogbonlo samuelarogbonlo commented Jan 14, 2025

Add support for internal service specific labels
Fixes #12428

Description
This PR adds the ability to specify labels specifically for the internal ingress-nginx service without affecting the main controller service. This is particularly useful for use cases like external-dns configuration where labels need to be set only on the internal service.

Changes

  • Modified templates/controller-service-internal.yaml to support internal-specific labels
  • Removed mandatory annotations requirement for internal service
  • Fixed indentation in templates/controller-deployment.yaml
  • Added test case for internal service labels

Code Changes

  1. Added support for internal-specific labels:
 labels:
    {{- include "ingress-nginx.labels" . | nindent 4 }}
    app.kubernetes.io/component: controller
  {{- if .Values.controller.service.internal.labels }}
    {{- toYaml .Values.controller.service.internal.labels | nindent 4 }}
  {{- end }}
  1. Removed mandatory annotations requirement:

From

{{- if and .Values.controller.service.enabled .Values.controller.service.internal.enabled .Values.controller.service.internal.annotations -}}

To

{{- if and .Values.controller.service.enabled .Values.controller.service.internal.enabled -}}

Testing Performed
Tested the following scenarios:

  1. Adding custom labels to internal service only
  2. Verifying label isolation (labels on internal service don't appear on main service)
  3. Creating internal service without requiring annotations
  4. Confirming template renders correctly

Test configuration added in:
charts/ingress-nginx/ci/controller-service-internal-labels-values.yaml

Usage Example

controller:
  service:
    internal:
      enabled: true
      labels:
        external-dns.alpha.kubernetes.io/hostname: internal.example.com
        custom-label: test-value

Backward Compatibility
This change maintains backward compatibility by:

  • Not changing behavior for existing configurations
  • Only removing restrictions (required annotations)
  • Preserving all existing label inheritance where appropriate
  • Not requiring configuration of internal labels

Checklist

  • [ ✅ ] Code follows repository style and conventions
  • [ ✅ ] Templates render correctly
  • [ ✅ ] Added test configuration
  • [ ✅ ] Maintains backward compatibility
  • [ ✅ ] Verified label isolation works as expected

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/helm Issues or PRs related to helm charts labels Jan 14, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 14, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @samuelarogbonlo!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 14, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @samuelarogbonlo. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 14, 2025
Copy link

netlify bot commented Jan 14, 2025

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit bf9b05b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/67907b71b514e40008a2eed2

@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch from 1f89703 to 17827d8 Compare January 14, 2025 23:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 14, 2025
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch from 17827d8 to 66edf87 Compare January 14, 2025 23:18
@Gacko
Copy link
Member

Gacko commented Jan 15, 2025

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2025
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch from 66edf87 to 13f3e6c Compare January 15, 2025 08:59
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 15, 2025
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch 2 times, most recently from 8a66548 to 2e25b63 Compare January 15, 2025 10:27
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 15, 2025
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better! Thank you! Please also consider adding unit tests in the tests/ directory.

charts/ingress-nginx/values.yaml Outdated Show resolved Hide resolved
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch 3 times, most recently from 748a1eb to 657c25b Compare January 15, 2025 20:49
@Gacko
Copy link
Member

Gacko commented Jan 17, 2025

Oh, and please update the README.md by running helm-docs.

@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch from 7097f5f to 9a0992a Compare January 17, 2025 13:55
@samuelarogbonlo
Copy link
Contributor Author

Oh, and please update the README.md by running helm-docs.

Done

test-values.yaml Outdated Show resolved Hide resolved
charts/ingress-nginx/values.yaml Outdated Show resolved Hide resolved
charts/ingress-nginx/values.yaml Outdated Show resolved Hide resolved
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch 2 times, most recently from a5595f2 to 36cb6e5 Compare January 17, 2025 15:22
@samuelarogbonlo samuelarogbonlo force-pushed the feat/add-internal-service-labels branch 2 times, most recently from 5ce79c0 to e29a446 Compare January 18, 2025 13:57
@Gacko Gacko force-pushed the feat/add-internal-service-labels branch from e29a446 to e588441 Compare January 21, 2025 23:29
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/triage accepted
/kind feature
/priority backlog
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 21, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2025
@samuelarogbonlo samuelarogbonlo requested a review from Gacko January 22, 2025 05:03
@Gacko
Copy link
Member

Gacko commented Jan 22, 2025

This PR was already fine and approved. There's no beed to update it. Please just leave it as it is for now. 🙂

Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gacko, samuelarogbonlo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Gacko
Copy link
Member

Gacko commented Jan 22, 2025

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 22, 2025
@Gacko
Copy link
Member

Gacko commented Jan 22, 2025

My fault, forgot to unhold.

@k8s-ci-robot k8s-ci-robot merged commit fe91e8e into kubernetes:main Jan 22, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/helm Issues or PRs related to helm charts cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Helm chart] support adding separate labels for the ingress-nginx-controller-internal service
3 participants